//引入 VueRouter
import VueRouter from 'vue-router'
//引入 Vue
import Vue from 'vue';
//使用VueRouter
Vue.use(VueRouter);

// 引入路由组件
import Home from '@/pages/Home'
import Login from '@/pages/Login'
import Search from '@/pages/Search'
import Register from '@/pages/Register'

//暴露
export default new VueRouter({
    routes: [
        { 
            path:'/home',
            component:Home,
            meta:{show:true}
        },
        {
            path:'/login',
            component:Login,
            meta:{show:false}
        },
        {
            path:'/search/:keyword?',
            component:Search,
            name:'search',
            meta:{show:true}
        },
        {
            path:'/register',
            component:Register,
            meta:{show:false}
        },
        //重定向
        {
            path:'/',
            redirect:'/home'
        }
    ]
})